<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login !!!</title>
<link type="text/css" rel="stylesheet" href="public/css/login.css" />
</head>

    <body>
        
    </body>
</html>

<?php
require_once 'data/users.php';

if (isset($_POST["submit"])) {
    $co = false;
    for ($i = 0; $i < count($users); $i++) {
        if (strcmp($_POST["name"], $users[$i]["username"]) == 0 && strcmp($_POST["password"], $users[$i]["password"]) == 0) {
            $co = true;
            break;
        } else {
            $co = false;
        }
    }
    if ($co == true)
        echo "<div class='thanhcong'>" . $_POST["name"] . " Đăng nhập thành công.</div>";
    else 
        echo "<div class='loi'>" . $_POST["name"] . " Không hợp lệ  <a href='login.html'> Back Login</a> !!!</div>";
} else {
    header("Location: http://localhost:82/web_lop/doanvanquoc-web1-dangnhap/login.html");
}

?>